package exe;

/**
 * @author oldliu
 * @since 1.0
 */
public class UglyNumber {
    public static void main(String[] args) {
        int start=1;
        int count=0;
        int k;

        while (count<=1500){
            k=start;
            //验证start是不是只能被2，3，5分解
            while (k%2==0)
                k/=2;
            while (k%3==0)
                k/=3;
            while (k%5==0)
                k/=5;
            if(k==1){
                count++;
                System.out.print(start+" ");
                if(count%10==0)
                    System.out.println();
            }
            start++;

        }
    }
}
